from selenium import webdriver
from selenium.webdriver.common.by import By
import time


class Email_163:
    def __init__(self):
        self.driver = webdriver.Chrome()
        self.driver.maximize_window()
        self.driver.get('https://mail.163.com/')

    def login(self):
        m1 = self.driver.find_element(By.TAG_NAME, 'iframe').get_attribute('id')
        print(m1)
        self.driver.switch_to.frame(m1)
        time.sleep(2)
        self.driver.find_element(By.NAME, 'email').send_keys('lhl1309735715')
        time.sleep(2)
        self.driver.find_element(By.NAME, 'password').send_keys('lHl123456789')
        time.sleep(2)
        self.driver.find_element(By.ID, 'dologin').click()

    def send_email(self):
        self.driver.find_element(By.ID, '_mail_component_149_149').click()

    def quit(self):
        time.sleep(2)
        self.driver.quit()


if __name__ == '__main__':
    e1 = Email_163()
    e1.login()
    # e1.quit()
